package com.sjy.MyBlog.web;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.SessionAttribute;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.sjy.MyBlog.biz.impl.ArticleBizImpl;

@Controller
@SessionAttributes({"currentPage","articleId"})
public class PostAction {

	@Resource
	private ArticleBizImpl ab;
	
	@GetMapping("blog-post.do")
	public String toBlogPost(int id,Model m, @SessionAttribute(name="currentPage") String currentPage) {
		currentPage="blogpost::articleBody";
		m.addAttribute("currentPage", currentPage);
		m.addAttribute("articleWithBlobs", ab.selectArticleById(id));
		m.addAttribute("articleId", id);
		return currentPage;
	}
}
